package com.danng.taobao.thread;

import java.lang.reflect.InvocationTargetException;

import org.danng.taobao.StoreHouseModel;
import com.danng.taobao.BasciTask;
import com.danng.taobao.TradeTask;

import com.taobao.api.ApiException;
import com.taobao.api.domain.NotifyTrade;
import com.taobao.api.domain.Trade;

public class StorehouseThread extends BasciTask implements Runnable {
	private NotifyTrade notifyTrade;
	private StoreHouseModel storeHouseModel;
	public StorehouseThread() {
	}

	public StorehouseThread(NotifyTrade notifyTrade) {
		this.notifyTrade = notifyTrade;
	}

	@Override
	public void run() {
		Long tid = notifyTrade.getTid();
		TradeTask tradeTask = new TradeTask();

			try {
				Trade trade = tradeTask.getTradeFullInfo(tid);
				storeHouseModel.creatNewShAndSaveTrade(trade);
			} catch (ApiException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			

	}
}
